<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateTransverseContractsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('transverse_contracts', function (Blueprint $table) {
            $table->id();
            $table->string('code')->comment('合同编号');

            $table->string('name')->comment('合同名称');
            $table->string('type')->comment('合同类别');
            $table->float('amount',11,4)->default(0)->comment('合同金额');
            $table->string('year')->nullable()->comment('年度');
            $table->float('in_amount')->default(0)->comment('实际到账金额');
            $table->string('company')->nullable()->comment('技术吸纳单位');
            $table->string('legal_person')->nullable()->comment('法定代表人');
            $table->string('social_credit_code')->nullable()->comment('统一社会信用代码');
            $table->string('contact_person')->nullable()->comment('单位联系人');
            $table->string('contact_mobile')->nullable()->comment('联系电话');

            $table->text('file')->nullable()->comment('附件');

            $table->string('user_id')->default(0)->comment('负责人ID');
            $table->string('department_id')->default(0)->comment('部门');
            $table->string('creator_id')->default(0)->comment('创建人ID');

            $table->tinyInteger('review_status')->default(0)->comment('审核状态');
            $table->tinyInteger('dept_review_status')->default(0)->comment('院系审核');
            $table->string('review_remark')->nullable()->comment('审核备注');

            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('transverse_contracts');
    }
}
